#include<stdio.h>
#include<string>
using namespace std;
class LinearPolyominoCovering
{
public:
    string findCovering(string region)
    {
        int len = region.size();
        int i=0;
        while (i<len)
        {
            if (region[i] == '.')
            {
                i++;
                continue;
            }
            if (region[i] == 'X' && region[i+1] == 'X' && i+1<len)
            {
                if (i+3<len && region[i+2] == 'X' && region[i+3] == 'X')
                {
                    region[i] = 'A';
                    region[i+1] = 'A';
                    region[i+2] = 'A';
                    region[i+3] = 'A';
                    //i+=4;
                }
                else
                {
                    region[i] = 'B';
                    region[i+1] = 'B';
                    //i+=2;
                }
            }
            i+=2;
        }
        i=0;
        while (i<len)
        {
            if (region[i] == 'X')
                return "impossible";
            i++;
        }
        return region;
    }
};
